
let baseurl = "https://api-hmugo-web.itheima.net/api"
const request = (params) =>{
  wx.showLoading({
    title: '加载中',
  })
  return new Promise((resolve,reject)=>{
    wx.request({
      ...params,
      url: baseurl + params.url,
      success(res){
        resolve(res)
      },
      fail(err){
        reject(err)
      },
      complete(){
        wx.hideLoading()
      }
    })
  })
}

export default request